<template>
  <avue-form ref="form" v-model="form" :option="option"> </avue-form>
</template>
<script>
export default {
  props: {
    visible: { type: Boolean, default: false },
    matrixId: { type: String, default: '' }, // 指标ID
  },
  data() {
    return {
      form: {
        ids: [],
      },
      option: {
        menuBtn: false,
        detail: false,
        emptyBtn: false,
        submitBtn: false,
        column: [
          {
            label: '分享对象',
            prop: 'ids',
            type: 'select',
            multiple: true,
            filterable: true,
            row: true,
            span: 24,
            rules: [{ required: true, message: '请选择分享对象' }],
            dicUrl: '/jtx/matrix/share/shareUserList',
            props: {
              label: 'nick_name',
              value: 'user_id',
            },
            dicQuery: {
              matrixId: this.matrixId,
            },
            dicMethod: 'get',
            dicFormatter: (res) => {
              console.log(res)
              return res.filter((item) => item.status == '未分享')
            },
          },
        ],
      },
    }
  },
  watch: {
    visible(val) {
      if (val) {
        this.init()
      }
    },
  },
  created() {
    this.init()
  },
  methods: {
    async init() {
      // this.form.ids = this.ids
    },
    getValue() {
      return {
        ids: this.form.ids,
      }
    },
    validate(callback) {
      this.$refs.form.validate(callback)
    },
  },
}
</script>
